<template>
	<!-- 颜色选择  默认竖向  其次横向-->
	<view class="flex" style="margin-top: 28rpx;margin-bottom: 0rpx;">
		<!-- 竖向 -->
		<view class="colours" style="margin-right: 40rpx;" @click="directionFlag && selectdirection(0)" v-if="shuBoolean">
			<view :class="tabsele==0?'colours-yes':'colours-no'">
				<!-- 竖向 -->
				<slot name="black"></slot>
			</view>
			<image v-if="tabsele==0" src="@/static/index/selects@2x.png"></image>
		</view>
		<!-- 横向 -->
		<view class="colours" @click="directionFlag &&  selectdirection(1)" v-if="hengBoolean"
			style="margin-right: 40rpx;width: 216rpx;">
			<view :class="tabsele==1?'colours-yes':'colours-no'">
				<!--横向 -->
				<slot name="colours" ref="longflip"></slot>
			</view>
			<image v-if="tabsele==1" src="@/static/index/selectslong.png">
			</image>
		</view>
	</view>
</template>
<script>
	// clickFlag 是控制可不可以在点击sku的 和点击事件配合使用   有的时候选择完毕sku点击上传支付的时候  加载框在加载  这时候 sb用户在点击sku就不可以点击成功
	export default {
		props: {
			directionFlag: {
				type: Boolean,
				default: true
			},
			// 横向 
			hengBoolean: {
				type: Boolean,
				default: true
			},
			//竖向
			shuBoolean: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				tabsele: 0
			}
		},
		methods: {
			selectdirection(index) {
				this.tabsele = index;
				this.$emit('selectdirection',index)
			}
		}
	}
</script>

<style>
	.colours {
		width: 142rpx;
		height: 62rpx;
		position: relative
	}

	.colours>view {
		position: absolute;
		width: 100%;
		line-height: 62rpx;
		text-align: center;
		font-size: 14px;
		font-family: PingFang-SC-Medium;
		font-weight: 500;
	}

	.colours>text {
		position: absolute;
		width: 100%;
		line-height: 62rpx;
		/* bottom: 0rpx;left: 0rpx; */
		text-align: center;
		font-size: 14px;
		font-family: PingFang-SC-Medium;
		font-weight: 500;
	}

	.colours-yes {
		color: #FE5734;
	}

	.colours-no {
		border: 1px solid #E7E6E9;
		border-radius: 5px;
		color: #222222;
	}
</style>
